package com.gzq.controller;

import com.gzq.entity.ShortSlogan;
import com.gzq.service.IndexImageService;
import com.gzq.service.IndexPropagandaService;
import com.gzq.service.ShortSloganService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("index")
public class IndexController {
    @Resource
    IndexImageService indexImageService;
    @RequestMapping("image")
    public Map image(){
        Map map=new HashMap();
        map.put("rs",indexImageService.findAll());
        return map;
    }

    /**
     * 第一个宣传语
     */
    @Resource
    IndexPropagandaService indexPropagandaService;
    @RequestMapping("propaganda")
    public Map propaganda(){
        Map map=new HashMap();
        map.put("propaganda",indexPropagandaService.findAll(1));
        return map;
    }

    /**
     * 第二个宣传语
     * @return
     */
    @RequestMapping("propaganda1")
    public Map propaganda1(){
        Map map=new HashMap();
        map.put("propaganda1",indexPropagandaService.findAll(2));
        return map;
    }
    /**
     * 关于我们slogan(id=3)
     * 成功案列slogan(id=4)
     * 推荐阅读slogan(id=5)
     *
     */
    @RequestMapping("slogan")
    public Map propaganda2(){
        Map map=new HashMap();
        map.put("slogan",indexPropagandaService.findAllText());
        return map;
    }
    @Resource
    ShortSloganService shortSloganService;
    @RequestMapping("shortslogan")
    public  Map findText(ShortSlogan shortSlogan){
        Map map=new HashMap();
        map.put("slogan",shortSloganService.findText(shortSlogan.getStatus()));
        return  map;
    }
}
